package com.ustc.test.springmvc.controller;

import com.ustc.test.springmvc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Haiyuan on 2015/4/29.
 */
public class UserController implements Controller {

    @Autowired
    private UserService userService;

    public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws Exception {
        req.setAttribute("a", "aaaa");
        userService.add(req.getParameter("userName"));
        return new ModelAndView("index");
    }
}
